home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TSPA3340.ZIP / TSUNTG.INT < prev    next >
Text File  |  1993-07-26  |  8KB  |  223 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT G
  5. A Turbo Pascal unit of informative routines, Crt replacements,
  6. keyboad routines and redirection.
  7. All rights reserved 26-Nov-89
  8. Updated 6-Dec-89, 20-Mar-90, 22-Jul-90, 1-Aug-90, 8-Aug-90, 27-Oct-91,
  9.         13-Jun-92, 19-Oct-92, 8-Nov-92, 26-Jul-93
  10.  
  11. This unit may be used and distributed freely for PRIVATE,
  12. NON-COMMERCIAL, NON-INSTITUTIONAL purposes, provided it is not
  13. changed in any way, and that a proper attribution is made. For ANY
  14. other usage, such as use in a business enterprise or a university,
  15. contact the author for the terms of registration.
  16.  
  17. The units are under development. Comments and contacts are solicited. If
  18. you have any questions, please do not hesitate to use electronic mail for
  19. communication.
  20. InterNet address: ts@uwasa.fi         (preferred)
  21. Bitnet address:   SALMI@FINFUN
  22.  
  23. The author shall not be liable to the user for any direct, indirect or
  24. consequential loss arising from the use of, or inability to use, any unit,
  25. program or file howsoever caused. No warranty is given that the units and
  26. programs will work under all circumstances.
  27.  
  28. Timo Salmi
  29. Professor of Accounting and Business Finance
  30. Faculty of Accounting & Industrial Management; University of Vaasa
  31. P.O. BOX 297, FI-65101 Vaasa, Finland
  32.  
  33. Added 27-Oct-91:
  34.  ISANSIFN
  35.  
  36. Added 13-Jun-92
  37.  GETSCAN
  38.  GETESCAN
  39.  
  40. Added 19-Oct-92:
  41.  FLOPSTFN
  42.  ISUBSTFN
  43.  
  44. Added 8-Nov-92:
  45.  ACTDRVFN
  46.  MEDIAFN
  47.  
  48. Added 30-Jun-93
  49.  ISRAMFN
  50.  
  51. Moved to TSUNTBOT 26-Jul-93
  52.  WARMBOOT
  53.  COLDBOOT
  54.  
  55. *)
  56.  
  57. unit TSUNTG;
  58.  
  59. (* ======================================================================= *)
  60.                           interface
  61. (* ======================================================================= *)
  62.  
  63. uses Dos
  64.      {$IFDEF VER40}
  65.      ,TSUNT45
  66.      {$ENDIF}
  67.      ;
  68.  
  69. (* =======================================================================
  70.                      Informative routines
  71.    ======================================================================= *)
  72.  
  73. (* Number of diskette drives on the system *)
  74. function DRIVESFN : byte;
  75.  
  76. (* The name of the first diskette drive on the system *)
  77. function FDRIVEFN : char;
  78.  
  79. (* Number of disk devices. Only for MsDos 3.+, else returns 0, harcoded *)
  80. function DSKCNTFN : byte;
  81.  
  82. (* Is a media present in the given drive. Argument '0' can be used to
  83.    denote the default drive *)
  84. function INDRIVFN (drive : char) : boolean;
  85.  
  86. (* Is a media a fixed disk. Takes the drive letter (case independent) as
  87.    the argument. Argument '0' can be used for the default drive *)
  88. function FIXEDFN (drive : char) : boolean;
  89.  
  90. (* Get the floppy disk status. Is the floppy present and formatted.
  91.    For the status values see TSUNTG.TST procedure TEST16, or
  92.    interrupt $13 function $01 in Ralf Brown's inter32a.zip *)
  93. function FLOPSTFN (drive : char) : integer;
  94.  
  95. (* Test whether a drive is a substituted drive, that is has been subjected
  96.    to the MsDos subst command.  Requires a minumum of MsDos 3.1 *)
  97. function ISUBSTFN (drive : char) : boolean;
  98.  
  99. (* What kind of a disk media is in a disk drive.
  100.    Takes the drive letter (case independent) as the argument.
  101.    Argument '0' can be used for the default drive.
  102.    For the returned values see TEST18 in TSUNTG.TST
  103. *)
  104. function MEDIAFN (drive : char) : byte;
  105.  
  106. (* Get the currently active floppy drive on one drive systems.
  107.    Returns the drive letter 'A' or 'B'.
  108.    For an error returns '0', for two drive systems returns '2'. *)
  109. function ACTDRVFN : char;
  110.  
  111. (* Is a drive a ram probable disk
  112.    Network drivers and other special circumstances may interfere *)
  113. function ISRAMFN (drive : char) : boolean;
  114.  
  115. (* =======================================================================
  116.                Crt replacements and their derivates
  117.    ======================================================================= *)
  118.  
  119. (* Set a 25*80 text mode and clear screen, no Crt unit required *)
  120. procedure CLS;
  121.  
  122. (* Set a 25*40 text mode and clear screen, no Crt unit required *)
  123. procedure CLS40;
  124.  
  125. (* As Turbo Pascal GoToYX but does not require the Crt unit *)
  126. procedure GOATXY (x, y : integer);
  127.  
  128. (* As Turbo Pascal WhereX but does not require the Crt unit *)
  129. function WHEREXFN : byte;
  130.  
  131. (* As Turbo Pascal WhereY but does not require the Crt unit *)
  132. function WHEREYFN : byte;
  133.  
  134. (* Reverse the colors of an area.
  135.    This is slow. For fast screen routines see TSUNTA. *)
  136. procedure REVAREA (x1, y1, x2, y2 : integer);
  137.  
  138. (* Returns whether ANSI.SYS or a similar screen driver has been loaded or not.
  139.    Use while in the text mode. Do not call not in the graphics modes.
  140.    Don't use the TP Crt unit in your program if you want ISANSIFN to work. *)
  141. function ISANSIFN : boolean;
  142.  
  143. (* =======================================================================
  144.                 Key routines with no Ctr needed
  145.    ======================================================================= *)
  146.  
  147. (* As Turbo Pascal KeyPressed but does not require the Crt unit *)
  148. function KEYPREFN : boolean;
  149.  
  150. (* As Turbo Pascal ReadKey but does not require the Crt unit *)
  151. function READKEFN : char;
  152.  
  153. (* Enhanced keyboard ReadKey, no Ctr unit needed. Detects also F11 and F12,
  154.    and distinguishes between the numeric keypad and the gray keys.
  155.    Lower part of the word returns the first scan code, the higher part
  156.    the second, if applicable. *)
  157. function RDENKEFN : word;
  158.  
  159. (* This function resembles the traditional Basic inkey function.
  160.    It returns the pressed character with no echo. Special chacarters
  161.    are returned in the usual paired manner (chr(0) + code).
  162.    If timelimit seconds is exceeded timeout becomes true (and a
  163.    chr(0) is returned by inkeyfn). *)
  164. function INKEYFN (timelimit : real; var timeout : boolean) : char;
  165.  
  166. (* =======================================================================
  167.         More key routines with no Ctr needed, no key repeat
  168.    ======================================================================= *)
  169.  
  170. (* Is the left shift key depressed *)
  171. function LFSHFTFN : boolean;
  172.  
  173. (* Is the right shift key depressed *)
  174. function RTSHFTFN : boolean;
  175.  
  176. (* Is the ctrl key depressed *)
  177. function CTRLFN : boolean;
  178.  
  179. (* Is the left ctrl key depressed *)
  180. function LFCTRLFN : boolean;
  181.  
  182. (* Is the right ctrl key depressed *)
  183. function RTCTRLFN : boolean;
  184.  
  185. (* Is the alt key depressed *)
  186. function ALTFN : boolean;
  187.  
  188. (* Is the left alt key depressed *)
  189. function LFALTFN : boolean;
  190.  
  191. (* Is the right alt key depressed *)
  192. function RTALTFN : boolean;
  193.  
  194. (* Is the SysRq key depressed *)
  195. function SYSRQFN : boolean;
  196.  
  197.  
  198. (* =======================================================================
  199.                   Getting keyscan codes
  200.    ======================================================================= *)
  201.  
  202. (* Every now and then a programmer need to find out the scan codes
  203.    of the keyboard keys. GETSCAN returns the scancode (and the ascii
  204.    value) of the key pressed. For an enhanced AT keyboard use
  205.    GETESCAN. Goes to TSUNTG *)
  206. procedure GETSCAN (var scancode, character : byte);
  207.  
  208. (* Get scancode and ascii value of a key pressed for an enhanced
  209.    keyboard. To test the presence of an enhanced keyboard use
  210.    ISENHAFN from the TSUNTH unit *)
  211. procedure GETESCAN (var scancode, character : byte);
  212.  
  213. (* =======================================================================
  214.                       Redirection
  215.    ======================================================================= *)
  216.  
  217. (* Direct write and writeln to printer *)
  218. procedure USEPRN;
  219.  
  220. (* Direct write and writeln to the screen *)
  221. procedure USECON;
  222.  
  223.